<template>
  <div>

    <h3>示例一、父向子组件传递一个字符串</h3>
    <!-- <son :msg="msg"></son> -->

    <h3>示例二、父向子组件传递一个对象</h3>
    <!-- <son :msgObject="msgObject"></son> -->

    <h3>示例三、子组件向父组件传递</h3>
    <pan>父组件的msg:{{msg}}</pan>
    <son @setMsg="setMsg" ref="son"></son>
    <el-button type="primary" @click="getSon()">父组件</el-button>

  </div>
</template>

<script>
import son from '../function/sonTemplate.vue'
export default {

  data () {
    return {
      msg: '片言',

      //   msgObject: '1212',

      msgObject: {
        passport: '123456',
        account: 'asen',
        isleal: true,

      }
    }
  },

  methods: {

    setMsg (value) {
      this.msg = value
    },

    getSon () {
      this.msg = this.$refs.son.sonName
    }
  },

  components: {
    son
  }

}
</script>

<style scoped>
</style>